<!DOCTYPE html>
<title>Custom Elements: create an element inside a template </title>
<link rel="help" href="https://dom.spec.whatwg.org/#concept-create-element">
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/custom-elements-helpers.js"></script>
<iframe id="iframe"></iframe>
<script>
'use strict';

iframe.srcdoc = `<template id="test"><a-a></a-a></template>`;
setup({ explicit_done: true });
iframe.onload = () => {
  let doc = iframe.contentDocument;
  let w = doc.defaultView;
  let tmpl = doc.querySelector('#test');
  let element = tmpl.content.querySelector('a-a');
  w.customElements.define('a-a', class extends w.HTMLElement {});
  test(function () {
    assert_true(element.matches(':not(:defined)'));
    assert_true(element instanceof w.HTMLElement);
  }, 'Custom element state in template content should be "not defined"');
  done();
};
</script>
